/*
 * @Author: heinan
 * @Date: 2023-07-27 20:57:41
 * @Last Modified by: heinan
 * @Last Modified time: 2023-07-27 21:27:32
 */
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");

class CustomService {
  constructor() {
    this.port = process.env.PORT || 3001;
  }
  init() {
    this.app = express();
    this.midleware();
    this.router();
    this.running();
  }
  midleware() {
    this.app.use(bodyParser.json());
    this.app.use(bodyParser.urlencoded({ extended: false }));
  }
  router() {
    this.app.use("/openai", require("./router"));
  }
  running() {
    this.app.listen(this.port, () => {
      console.log(`Custom Server listening on port ${this.port}`);
    });
  }
}

module.exports = CustomService;
